.geometry-model-view {
  min-height: 100vh;
  background: #f5f5f7;
  display: flex;
  flex-direction: column;
  font-family: 'Times New Roman', Times, serif;
  font-style: italic;
}

/* 全屏模式 */
.geometry-model-view.full-screen {
  height: 100vh;
  padding: 0;
  margin: 0;
  overflow: hidden;
  position: relative;
}

/* 特殊模型视图：无内边距，让Canvas充满整个屏幕 */
.geometry-model-view.special-model-view {
  padding: 0;
  margin: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  overflow: hidden;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
}

/* Header */
.view-header {
  background: #ffffff;
  border-bottom: 1px solid #e5e5e7;
  padding: 1.5rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.view-header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.view-title {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.view-title h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0;
  letter-spacing: -0.01em;
}

.view-title p {
  font-size: 0.875rem;
  color: #86868b;
  margin: 0;
}

/* Content */
/* 主容器 - 全屏白色盒子 */
.full-screen .main-container {
  background: #ffffff;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
}

/* 顶部栏：Logo 和标题（带背景图） */
.top-bar {
  background-image: url('/geometry/back.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #e5e5e7;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}


.back-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  background: #1890ff;
  border: none;
  border-radius: 6px;
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: fit-content;
  position: relative;
  z-index: 10;
  margin-right: auto;
}

.back-button:hover {
  background: #40a9ff;
}

.back-button:active {
  transform: scale(0.98);
  background: #096dd9;
}

.app-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.app-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1890ff;
  margin: 0;
  text-align: center;
  font-family: 'Microsoft YaHei', '微软雅黑', sans-serif;
  text-shadow: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  pointer-events: none;
}

/* 内容布局：左中右三栏 */
.content-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* 左侧边栏：常量监控 */
.left-sidebar {
  width: 110px;
  padding: 0.5rem 0.4rem;
  border-right: none;
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.constant-item {
  display: flex;
  align-items: center;
  font-size: 0.7rem;
  line-height: 1.2;
  padding: 0.1rem 0;
}

.constant-name {
  color: #1d1d1f;
  font-weight: 500;
  font-style: italic;
}

.constant-name sub {
  font-style: normal;
  font-size: 0.65em;
  vertical-align: sub;
}

.constant-equals {
  color: #86868b;
  margin: 0 0.15rem;
}

.constant-value {
  color: #007AFF;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-style: normal;
}

/* 中间内容区 */
.center-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  overflow: hidden;
  min-height: 0;
}

/* 右侧边栏：按钮 */
.right-sidebar {
  width: 130px;
  padding: 0.5rem 0.5rem;
  border-left: none;
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* 底部信息栏（贯穿整个底部） */
.bottom-info {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-top: 1px solid #e5e5e7;
  flex-wrap: wrap;
  flex-shrink: 0;
  background: #ffffff;
}

/* 拖动提示 */
.drag-hint {
  font-size: 0.8125rem;
  color: #86868b;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* 表达式显示 */
.expression-display {
  font-size: 0.9375rem;
  line-height: 1.5;
}

.expression-formula {
  color: #1d1d1f;
  font-style: italic;
}

.expression-result {
  color: #34c759;
  font-weight: 600;
  margin-left: 0.5rem;
  font-style: normal;
}

/* 分式显示 */
.fraction {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 0.2em;
}

.fraction-numerator,
.fraction-denominator {
  padding: 0 0.3em;
  line-height: 1.2;
  font-style: italic;
}

.fraction-line {
  width: 100%;
  height: 1px;
  background-color: #1d1d1f;
  margin: 0.2em 0;
  min-width: 1.5em;
}

/* Canvas Container */
.canvas-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
  overflow: hidden;
}

.canvas-container canvas {
  cursor: pointer;
  background: #f8f9fa;
  display: block;
}

/* Instructions (提示信息) */
.instructions {
  background: linear-gradient(135deg, #007AFF, #5856D6);
  color: white;
  padding: 1.5rem 2rem;
  border-radius: 0;
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.2);
}

.instructions h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.instructions ul {
  margin: 0;
  padding: 0 0 0 1.25rem;
  list-style: none;
}

.instructions li {
  font-size: 0.9375rem;
  line-height: 1.8;
  position: relative;
  opacity: 0.95;
}

.instructions li::before {
  content: '→';
  position: absolute;
  left: -1.25rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: #1890ff;
  color: white;
  border: none;
  padding: 0.5rem 0.875rem; /* 统一padding，确保高度一致 */
  border-radius: 6px;
  font-size: 0.875rem; /* 统一字体大小 */
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  width: 100%;
  min-width: fit-content;
  min-height: 36px; /* 确保最小高度一致 */
  box-sizing: border-box; /* 确保border不影响高度 */
}

.btn-primary:hover {
  background: #40a9ff;
}

.btn-primary:active {
  transform: scale(0.98);
  background: #096dd9;
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f7;
  color: #1d1d1f;
  border: 1px solid #e5e5e7;
  padding: 0.5rem 0.875rem; /* 统一padding，确保高度一致 */
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  width: 100%;
  min-width: fit-content;
  min-height: 36px; /* 确保最小高度一致 */
  box-sizing: border-box; /* 确保border不影响高度 */
}

.btn-secondary:hover {
  background: #e8e8ed;
  border-color: #d2d2d7;
}

.btn-secondary:active {
  transform: scale(0.98);
}

.reset-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reset-btn svg {
  width: 16px;
  height: 16px;
}

/* Loading & Error States */
.loading-container,
.error-container {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid #e5e5e7;
  border-top-color: #007AFF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-container p,
.error-container p {
  font-size: 1rem;
  color: #86868b;
}

.error-container p {
  color: #FF3B30;
}

/* Responsive */
@media (max-width: 1024px) {
  .canvas-container {
    padding: 1.5rem;
  }

  .canvas-container canvas {
    max-width: 100%;
    height: auto;
  }
}

/* 小屏幕响应式布局（旋转90度，模拟横屏效果） */
@media (max-width: 480px) {
  /* 旋转整个视图容器 */
  .geometry-model-view.full-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vh;
    height: 100vw;
    /* 从左上方旋转90度（顺时针），然后平移到正确位置 */
    /* 旋转90度后，需要向上移动100vw，这样容器才能完全显示 */
    transform-origin: top left;
    transform: rotate(90deg) translateY(-100vw);
    margin-left: 0;
    margin-top: 0;
    /* 确保不超出视口 */
    overflow: hidden;
  }
  
  /* 主容器：宽高互换以匹配旋转后的显示 */
  .full-screen .main-container {
    width: 100vh;
    height: 100vw;
  }
  
  /* 顶部栏调整 */
  .top-bar {
    padding: 0.5rem 1rem;
    min-height: 60px;
  }
  
  .app-title {
    font-size: 1.4rem;
    color: #0d66c4;
  }
  
  .app-logo {
    width: 40px;
    height: 40px;
  }
  
  .back-button {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    width: auto;
  }
  
  .back-text {
    display: inline;
  }

  .btn-primary {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    width: 100%;
  }
  
  /* 内容布局保持横向 */
  .full-screen .content-layout {
    flex-direction: row;
    height: calc(100vw - 60px - 60px); /* 减去顶部和底部高度 */
  }
  
  /* 左侧常量监控 */
  .left-sidebar {
    width: 130px;
    padding: 0.3rem 0.3rem;
    border-right: 1px solid #e5e5e7;
    flex-direction: column;
    gap: 0.1rem;
  }

  .constant-item {
    font-size: 0.6rem;
    line-height: 1.1;
    padding: 0.08rem 0;
  }

  /* 中间画布 */
  .center-content {
    padding: 0.3rem;
    flex: 1;
    min-width: 0;
  }

  .canvas-container {
    padding: 0;
  }

  /* 右侧按钮 */
  .right-sidebar {
    width: 120px;
    padding: 0.3rem 0.3rem;
    border-left: 1px solid #e5e5e7;
    flex-direction: column;
    gap: 0.3rem;
  }

  .right-sidebar .btn {
    padding: 0.25rem 0.4rem;
    font-size: 0.65rem;
    justify-content: center;
  }
  
  /* 底部信息栏 */
  .bottom-info {
    padding: 0.75rem 1.5rem;
    gap: 1.5rem;
    font-size: 0.8125rem;
    flex-wrap: wrap;
  }

  .drag-hint {
    font-size: 0.8125rem;
  }

  .expression-display {
    font-size: 0.9375rem;
  }
}

